﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows;

namespace DocumentsTagger.UI
{
    /// <summary>
    /// a converter to change a true/false value to bold/regular font weight
    /// </summary>
    public class BoolToFontWeightConverter:IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            FontWeight ans = FontWeights.Regular;
            if (value is Boolean)
            {
                if ((Boolean)value)
                {
                    ans = FontWeights.Bold;
                }
            }

            return ans;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            Boolean ans = false;
            if (value is FontWeight)
            {
                if ((FontWeight)value == FontWeights.Bold)
                {
                    ans = true ;
                }
            }

            return ans;
        }
    }
}
